	ORG	#8000

	DI
	CALL	#52
KNOW_A	DEC	SP
	DEC	SP
	LD	HL,#4000
	LD	DE,#4001
	LD	BC,6911
	LDIR
	POP	HL
	PUSH	HL
	LD	DE,PROG-KNOW_A+LEN_PROG-1
	ADD	HL,DE
	LD	DE,#4800+LEN_PROG-1
	LD	BC,LEN_PROG
	LDDR
	POP	HL
	LD	(L4B89),SP
	LD	SP,L4DFF
	PUSH	HL
	LD	A,69
	CALL	L4883
	POP	HL
	LD	DE,TEXT1-KNOW_A
	ADD	HL,DE
	CALL	L4AA3
	LD	DE,#0100
	LD	(L48D2),DE
	CALL	L4AA3
	LD	DE,#0303
	LD	(L48D2),DE
	CALL	L4AA3
	LD	DE,#0408
	LD	(L48D2),DE
	CALL	L4AA3
	LD	DE,#0604
	LD	(L48D2),DE
	CALL	L4AA3
	XOR	A
SOUND	LD	BC,#FFFD
	OUT	(C),A
	PUSH	AF
	LD	A,(HL)
	LD	B,#BF
	OUT	(C),A
	POP	AF
	INC	HL
	INC	A
	CP	#E
	JR	NZ,SOUND
	CALL	L4F89
	JP	L489D

TEXT1	DEFB	"FOXMON	128K (C)1993 by	(R)sof",#80+"t"
	DEFB	"Thanks	to SABSOFT & James Adven",#80+"t"
	DEFB	"Special thanks	to Rst7	fo",#80+"r"
	DEFB	"disks procedure",#80+"s"
	DEFB	"Interface: ZX-LPRINT II",#80+"I"
	DEFB	0,6,3,2,6,2,#10,#DC,#10,#10,#10,#11,#11,1

PROG	DISP	#4800

L4860	LD	HL,#4000
	LD	DE,#4001
	LD	BC,2047
	LD	(HL),L
	LDIR
	LD	A,7
L4883	LD	HL,#5800
	LD	DE,#5801
	LD	BC,#00FF
	LD	(HL),A
	LDIR
	INC	HL
	INC	DE
	LD	BC,#01FF
	LD	(HL),L
	LDIR
	XOR	A
	OUT	(254),A
	RET

L489D	CALL	L4860
L48A0	LD	B,#08
	CALL	L4A8E
	XOR	A
	LD	(L4FC4),A
	CALL	L4F8C
	CP	#51
	JP	Z,L4B83
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"R"
L4BA3	DEFB	" LEN",#80+"="
L4BA8	DEFB	"START",#80+"="
L4BAE	DEFB	" END",#80+"="
L4BB4	DEFB	" TO",#80+"="
L4BB8	DEFB	"JP",#80+"="
L4BBB	DEFB	"F",#80+":"
L4BBD	DEFB	"D",#80+":"
L4BBF	DEFB	"T",#80+":"
L4BC1	DEFB	"G",#80+":"
L4BC3	DEFB	"B",#80+":"
TXT_SEC	DEFB	" S",#80+":"
L4BD6	DEFB	"1=ADD:2=SUB:3=RL:4=RR:5=XOR:6=",#80+"N"
L4BF6	DEFB	#CD  ;CALL #5301 - return in FOXMON
	DEFW	L5301
L4BF9	DEFS	7

L4C60	LD	HL,L48D1
	LD	A,(HL)
	SUB	B
	LD	B,A
	DEC	(HL)
	INC	HL
	LD	A,(HL)
	SUB	B
	LD	(HL),A
	CALL	L4EEC
	LD	A,(L48D1)
	LD	B,A
	LD	A,#23
	CALL	L4FC7
	LD	HL,L4B8D
	SET	2,(HL)
	XOR	A
	LD	(L4FC4),A
	CALL	L4E6C
	LD	HL,L4BF9
L4C86	CALL	L4F60
	CP	#0C
	CALL	Z,L4E7D
	JR	Z,L4C86
	CP	#0D
	JR	Z,L4CB7
	CP	#30
	JP	C,L4E69
	CP	#47
	JP	NC,L4E69
	CP	#3A
	JR	C,L4CA7
	CP	#41
	JP	C,L4E69
L4CA7	LD	A,B
	OR	A
	JR	Z,L4C86
	LD	A,E
	CALL	L4FC7
	LD	(HL),A
	CALL	L4E6C
	INC	HL
	DEC	B
	JR	L4C86
L4CB7	LD	A,#48
	LD	(HL),A
	INC	HL
	CALL	L4EC5
	XOR	A
	LD	A,B
	RET

L4CC1	LD	A,#10
L4CC3	LD	(L48D1),A
	LD	B,A
	CALL	L4E6C
	LD	A,#01
	LD	(L4FC4),A
	LD	HL,L4B8D
	RES	2,(HL)
	LD	HL,L4DBD
L4CD7	CALL	L4F60
	CP	#0C	 ;DELETE
	CALL	Z,L4E7D	 ;DELETE OF CHAR
	JR	Z,L4CD7	 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CALL	L50CF
	CALL	L4FC5
	JR	C,L50AA
	PUSH	DE
	PUSH	DE
	PUSH	HL
	LD	IX,L48D0
	LD	DE,#0001
	XOR	A
	SCF
	EX	AF,AF'
	CALL	#0562
	POP	DE
	POP	IX
	CALL	#05A9
	LD	A,#00
	OUT	(#FE),A
	POP	DE
	JR	C,L5098
	PUSH	AF
	CALL	L4A7C
	POP	AF
	JR	NZ,L50AD
	PUSH	IX
	LD	HL,L4B9B
	CALL	L4AA3
	CALL	L4AA3
	POP	HL
	DEC	HL
	SBC	HL,DE
	CALL	L4A99
	CALL	L4ABC
L5098	LD	HL,L4B96
	CALL	L4AA3
	CALL	L4A99
	LD	A,(L48D0)
	CALL	L4AAF
	CALL	L4F8C
L50AA	JP	L5171

L50AD	LD	HL,L4B9B
	CALL	L4AA3
	JR	L5098

L50CF	CALL	L4D67
	RET	C
	PUSH	HL
	LD	A,#2C
	CALL	L4FC7
	CALL	L4D67
	POP	DE
	RET	C
	EX	AF,AF'
	RET	NC
	PUSH	DE
	PUSH	HL
	LD	HL,L4B96
	CALL	L4AA3
	LD	A,3
	CALL	L4D69
	CALL	L4FC5
	POP	DE
	POP	IX
	LD	A,L
	RET

L50F5	CALL	L4A7C
	LD	HL,L4BA8
	CALL	L4AA3
	CALL	L4D67
	JR	C,L5171
	PUSH	HL
	LD	HL,L4BAE
	CALL	L4AA3
	CALL	L4D67
	POP	DE
	JR	C,L5171
	PUSH	DE
	PUSH	HL
	CALL	L4A7C
	LD	HL,L4BD6
	CALL	L4AA3
L511B	CALL	L4F8C
	LD	C,#80
	CP	#31
	JR	Z,L5142
	LD	C,#90
	CP	#32
	JR	Z,L5142
	LD	C,#07
	CP	#33
	JR	Z,L515F
	LD	C,#0F
	CP	#34
	JR	Z,L515F
	LD	C,#A8
	CP	#35
	JR	Z,L5142
	LD	C,#78
	CP	#36
	JR	NZ,L511B
L5142	PUSH	BC
	PUSH	AF
	CALL	L4A7C
	LD	A,#4B
	CALL	L4FC7
	POP	AF
	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B8B)
	LD	DE,L4DBD
L521D	LD	A,(DE)
	CP	#80
	JR	NC,L51EC
	LD	(HL),A
	INC	HL
	INC	DE
	JR	L521D

L5228	CALL	L4A7C
	LD	HL,L4BBB
	CALL	L4AA3
	CALL	L4CC1
	JR	C,L5242
	LD	A,#10
	SUB	B
	LD	(L4B8F),A
	CALL	L4FC5
	CALL	L52A1
L5242	JP	L51EC

L5245	CALL	L5288
	LD	A,#40
	LD	(L4FD0),A
	LD	HL,L4BC1
	CALL	L4AA3
	LD	C,#10
	LD	DE,L4DBD
L5258	PUSH	BC
	PUSH	DE
	CALL	L4D67
	POP	DE
	POP	BC
	JR	C,L5288
	LD	B,A
	LD	A,(L48D1)
	CP	B
	JR	Z,L527C
	LD	A,#2C
	CALL	L4FC7
	LD	A,L
	LD	(DE),A
	INC	DE
	DEC	C
	JR	Z,L527C
	LD	A,H
	OR	A
	JR	Z,L5258
	LD	(DE),A
	INC	DE
	DEC	C
	JR	NZ,L5258
L527C	LD	A,#10
	SUB	C
	LD	(L4B8F),A
	CALL	L4FC5
	CALL	L52A1
L5288	LD	HL,#0600
	PUSH	HL
	CALL	L5291
	POP	HL
	INC	H
L5291	LD	(L48D2),HL
	CALL	L4A82
	DEC	H
	LD	(L48D2),HL
	LD	A,#20
	LD	(L4FD0),A
	RET

L52A1	LD	HL,(L4B8B)
	INC	HL
	LD	BC,#FFFF
L52A8	LD	A,(L4B8F)
	LD	(L48D1),A
	LD	DE,L4DBD
	LD	A,(DE)
	CPIR
	PUSH	HL
L52B5	LD	A,(L48D1)
	DEC	A
	LD	(L48D1),A
	JR	Z,L52C7
	INC	DE
	LD	A,(DE)
	CPI
	JR	Z,L52B5
	POP	HL
	JR	L52A8
L52C7	POP	HL
	DEC	HL
	LD	(L4B8B),HL
	RET

L52CD	CALL	L4A7C
	LD	HL,L4BB8
	CALL	L4AA3
	CALL	L4D67
	JR	C,L52E4
	CALL	L4FC5
	LD	SP,(L4B89)
	EI
	JP	(HL)
L52E4	CALL	L4A7C
	JP	L48A0

L52EA	LD	HL,(L4B8B)
	PUSH	HL
	LD	DE,L4BF6
	LD	BC,#0003
	LDIR
	POP	HL
	LD	DE,L5301
	LD	(HL),#CD
	INC	HL
	LD	(HL),E
	INC	HL
	LD	(HL),D
	RET
L5301	DI
	POP	DE
	DEC	DE
	DEC	DE
	DEC	DE
	LD	(L4B89),SP
	LD	SP,L4DFF
	LD	HL,L4BF6
	LD	BC,#0003
	LDIR
	JP	L489D

L4DBD	DEFS #36  ;STACK OF SEARCH MODE
L4DFF		  ;BEGIN OF STACK MONITOR

L5318	DEFB	#E0,#0A,#0E
	DEFB	#0F,#96,#AF
	DEFB	#B4,#B9,#BE
	DEFB	#BD,#C5,#09
	DEFB	"L",#C4,#04
	DEFB	#C5,",",#85
	DEFB	#00,#08,#0C
	DEFB	"%","*","U"
	DEFB	"\","i","k"
	DEFB	#09,"R","E"
	DEFB	#D4,#A4,"/"
	DEFB	#09,"P","O"
	DEFB	#D0,#94,#9A
	DEFB	"R","E",#D4
	DEFB	"E","X",#D8
	DEFB	"J","P"," "
	DEFB	"(","K",#A9
	DEFB	"L","D"," "
	DEFB	"S","P",","
	DEFB	#CB,#09,"J"
	DEFB	#D0,"$",#C1
	DEFB	#D7,#BA,"J"
	DEFB	"P"," ",#D7
	DEFB	#A0,"O","U"
	DEFB	"T"," ","("
	DEFB	"V",")",","
	DEFB	#C1,"I","N"
	DEFB	" ","A",","
	DEFB	"(","V",#A9
	DEFB	"E","X"," "
	DEFB	"(","S","P"
	DEFB	")",",",#CB
	DEFB	"E","X"," "
	DEFB	"D","E",","
	DEFB	"H",#CC,"D"
	DEFB	#C9,"E",#C9
	DEFB	#09,"C","A"
	DEFB	"L",#CC,"$"
	DEFB	#C1,#D7,"7"
	DEFB	#09,"P","U"
	DEFB	"S",#C8,#94
	DEFB	#81,"C","A"
	DEFB	"L","L"," "
	DEFB	#D7,",",#81
	DEFB	#D6,#09,"R"
	DEFB	"S",#D4,#BA
	DEFB	"0",#B0,"0"
	DEFB	#B8,"1",#B0
	DEFB	"1",#B8,"2"
	DEFB	#B0,"2",#B8
	DEFB	"3",#B0,"3"
	DEFB	#B8,":","R"
	DEFB	"L",#C3,"R"
	DEFB	"R",#C3,"R"
	DEFB	#CC,"R",#D2
	DEFB	"S","L",#C1
	DEFB	"S","R",#C1
	DEFB	"S","L",#C9
	DEFB	"S","R",#CC
	DEFB	#01,#A0,#85
	DEFB	#09,"B","I"
	DEFB	#D4,#1C,#C5
	DEFB	#09,"R","E"
	DEFB	#D3,#1C,#C5
	DEFB	#09,"S","E"
	DEFB	#D4,#1C,#C5
	DEFB	#00,#B4,#BB
	DEFB	#C3,#D1,#DE
	DEFB	#E1,#E9,#F0
	DEFB	#1B,"L",#C4
	DEFB	"C",#D0,"I"
	DEFB	#CE,"O",#D4
	DEFB	#06,#9A,#C9
	DEFB	#C4,"I",#D2
	DEFB	"D",#D2,#00
	DEFB	#08,"%","2"
	DEFB	"a","k","o"
	DEFB	"s","x","6"
	DEFB	#09,"J",#D2
	DEFB	"$",#C1,#AA
	DEFB	#9A,"N","O"
	DEFB	#D0,"E","X"
	DEFB	" ","A","F"
	DEFB	",","A","F"
	DEFB	#A7,"D","J"
	DEFB	"N","Z"," "
	DEFB	#AA,"J","R"
	DEFB	" ",#AA,"7"
	DEFB	#09,"L",#C4
	DEFB	#0C,#C1,#D7
	DEFB	#01,"A","D"
	DEFB	"D"," ",#CB
	DEFB	#CC,#09,"L"
	DEFB	#C4,#BA,"("
	DEFB	"B","C",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","B"
	DEFB	"C",#A9,"("
	DEFB	"D","E",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","D"
	DEFB	"E",#A9,"("
	DEFB	"W",")",","
	DEFB	#CB,"K",","
	DEFB	"(","W",#A9
	DEFB	"(","W",")"
	DEFB	",",#C1,"A"
	DEFB	",","(","W"
	DEFB	#A9,"/",#09
	DEFB	"I","N",#C3
	DEFB	#8C,#09,"D"
	DEFB	"E",#C3,#8C
	DEFB	#09,"I","N"
	DEFB	#C3,#84,#09
	DEFB	"D","E",#C3
	DEFB	#84,#09,"L"
	DEFB	#C4,#04,#C1
	DEFB	#D6,#BA,"R"
	DEFB	"L","C",#C1
	DEFB	"R","R","C"
	DEFB	#C1,"R","L"
	DEFB	#C1,"R","R"
	DEFB	#C1,"D","A"
	DEFB	#C1,"C","P"
	DEFB	#CC,"S","C"
	DEFB	#C6,"C","C"
	DEFB	#C6,#09,"I"
	DEFB	#CE,#04,#C1
	DEFB	"(","C",#A9
	DEFB	#01,"O","U"
	DEFB	"T"," ","("
	DEFB	"C",#A9,#C4
	DEFB	"?",#01,"S"
	DEFB	"B","C"," "
	DEFB	#CB,#CC,#01
	DEFB	"A","D","C"
	DEFB	" ",#CB,#CC
	DEFB	#09,"L",#C4
	DEFB	"/",#01,"("
	DEFB	"W",#A9,#CC
	DEFB	#0C,#C1,"("
	DEFB	"W",#A9,#81
	DEFB	"N","E",#C7
	DEFB	#01,"R","E"
	DEFB	#D4,#17,#81
	DEFB	#CE,#81,#C9
	DEFB	#09,"I",#CD
	DEFB	#9A,#B0,#AD
	DEFB	#B1,#B2,">"
	DEFB	#8A,"R","R"
	DEFB	#C4,"R","L"
	DEFB	#C4,#09,"L"
	DEFB	#C4,#9A,"I"
	DEFB	",",#C1,"R"
	DEFB	",",#C1,"A"
	DEFB	",",#C9,"A"
	DEFB	",",#D2
L54EE	DEFB	6,#0F,#15,#1B
	DEFB	#22,"-",#C2
	DEFB	#C3,#C4,#C5
	DEFB	#C8,#CC,"("
	DEFB	"Q",#A9,#C1
	DEFB	"B",#C3,"D"
	DEFB	#C5,#CB,"S"
	DEFB	#D0,"B",#C3
	DEFB	"D",#C5,#CB
	DEFB	"A",#C6,#B0
	DEFB	#B1,#B2,#B3
	DEFB	#B4,#B5,#B6
	DEFB	#B7,"N",#DA
	DEFB	#DA,"N",#C3
	DEFB	#C3,"P",#CF
	DEFB	"P",#C5,#D0
	DEFB	#CD,"A","D"
	DEFB	"D"," ","A"
	DEFB	#AC,"A","D"
	DEFB	"C"," ","A"
	DEFB	#AC,"S","U"
	DEFB	"B",#A0,"S"
	DEFB	"B","C"," "
	DEFB	"A",#AC,"A"
	DEFB	"N","D",#A0
	DEFB	"X","O","R"
	DEFB	#A0,"O","R"
	DEFB	#A0,"C","P",#A0
L5544	DEFB	"H","A"
	DEFB	"L",#D4
L5548	DEFB	"H",#CC,"I",#D8
	DEFB	"I",#D9

L554E	LD	HL,(L4B8B)
	PUSH	HL
	LD	HL,#0000
L5555	LD	(L48D2),HL
	PUSH	HL
	PUSH	BC
	CALL	L556C
	POP	BC
	POP	HL
	INC	H
	DJNZ	L5555
	POP	HL
	LD	(L4B8B),HL
	LD	DE,#0898
	JP	L4E63
L556C	XOR	A
	LD	HL,L48D0
	LD	(HL),A
	INC	HL
	LD	(HL),A
	INC	HL
	LD	(HL),A
	LD	A,#11
	LD	(L48D5),A
	LD	HL,(L4B8B)
	CALL	L4B60
	LD	A,(L48D2)
	INC	A
	LD	(L48D4),A
	LD	DE,#0000
	CALL	L55E4
	LD	A,(L48D4)
	LD	(L48D2),A
	LD	B,A
	LD	A,#10
	SUB	B
	JR	Z,L559C
	CALL	L55A7
L559C	LD	A,(L48D5)
	LD	(L48D2),A
	LD	B,A
	LD	A,#20
	SUB	B
	RET	Z
L55A7	LD	B,A
L55A8	CALL	L4FC5
	DJNZ	L55A8
	RET
L55AE	PUSH	HL
	LD	A,(L48D4)
	LD	(L48D2),A
	LD	HL,(L4B8B)
	LD	A,(HL)
	INC	HL
	LD	(L4B8B),HL
	PUSH	AF
	CALL	L4B6D
	LD	A,(L48D2)
	LD	(L48D4),A
	POP	AF
	POP	HL
	RET
L55CA	LD	HL,L48D4
	DEC	(HL)
	DEC	(HL)
	LD	HL,(L4B8B)
	DEC	HL
	LD	(L4B8B),HL
	DJNZ	L55CA
	LD	A,#3F
	JP	L56F3
L55DD	INC	D
L55DE	INC	D
	LD	A,D
	CP	#03
	JR	NC,L55CA
L55E4	CALL	L55AE
	LD	B,#01
	CP	#76
	JP	Z,L5685
	CP	#DD
	JR	Z,L55DE
	CP	#FD
	JR	Z,L55DD
	CP	#CB
	JR	Z,L55FF
	CP	#ED
	JR	NZ,L563C
	INC	E
L55FF	INC	E
	LD	A,E
	LD	(L48D1),A
	XOR	A
	OR	D
	JR	NZ,L5612
	LD	A,E
	CP	#01
	JR	NZ,L561D
	CALL	L55AE
	JR	L563C
L5612	LD	A,E
	CP	#02
	JR	Z,L55CA
	CALL	L55AE
	LD	(L48D0),A
L561D	CALL	L55AE
	LD	C,A
	LD	A,E
	CP	#01
	JR	NZ,L5631
	LD	B,#03
	LD	A,C
	AND	#07
	CP	#06
	JR	NZ,L55CA
	JR	L563B
L5631	LD	A,#3F
	CP	C
	JR	NC,L55CA
	LD	A,#BB
	CP	C
	JR	C,L55CA
L563B	LD	A,C
L563C	LD	(L4B8E),A
	RLA
	RL	E
	RLA
	RL	E
	LD	A,E
	LD	HL,L5318
	CALL	L5673
L564C	LD	A,(HL)
	INC	HL
	LD	BC,L5664
	PUSH	BC
	PUSH	HL
	PUSH	AF
	LD	HL,L5669
	CALL	L5671
	POP	AF
	RRCA
	RRCA
	RRCA
	LD	E,A
	EX	(SP),HL
	LD	A,(L4B8E)
	RET
L5664	BIT	4,E
	JR	Z,L564C
	RET
L5669	EX	AF,AF'
	DJNZ	L56A0
	LD	(HL),#46
	LD	C,B
	LD	H,B
	LD	E,B
L5671	AND	#07
L5673	LD	C,A
	LD	B,#00
	ADD	HL,BC
	LD	C,(HL)
	ADD	HL,BC
	RET
L567A	CALL	L5688
	BIT	0,E
	RET	Z
	LD	A,#20
	JP	L56F3
L5685	LD	HL,L5544
L5688	BIT	3,E
	RES	3,E
	LD	A,#2C
	CALL	NZ,L56F3
L5691	LD	A,(HL)
	BIT	7,A
	RES	7,A
	PUSH	AF
	CALL	NC,L56DF
	INC	HL
	POP	AF
	JR	Z,L5691
	RET
L569F	RRA
L56A0	RRA
	RRA
	AND	#07
	LD	C,A
	LD	A,E
	AND	#07
L56A8	LD	B,A
	INC	B
L56AA	XOR	A
	CP	C
	CALL	L5688
	DEC	C
	DJNZ	L56AA
	RET
L56B3	RRA
	RRA
	RRA
	PUSH	HL
	LD	HL,L54EE
	PUSH	AF
	LD	A,E
	CALL	L5671
	POP	AF
	AND	#07
	LD	C,A
	CALL	L56A8
	POP	HL
	RET
L56C8	RRCA
	XOR	#04
	BIT	2,A
	JR	L56D1
L56CF	BIT	5,A
L56D1	RES	5,A
	LD	(L4B8E),A
	RET	NZ
	LD	A,E
	AND	#07
	LD	C,A
	LD	B,#00
	ADD	HL,BC
	RET
L56DF	CP	#4B
	JR	Z,L5733
	CP	#51
	JR	Z,L5741
	CP	#56
	JR	Z,L5702
	CP	#57
	JR	Z,L5719
	CP	#2A
	JR	Z,L5767
L56F3	PUSH	AF
	LD	A,(L48D5)
	LD	(L48D2),A
	INC	A
	LD	(L48D5),A
	POP	AF
	JP	L4FC7
L5702	CALL	L55AE
	PUSH	HL
	PUSH	AF
	LD	A,(L48D5)
	LD	(L48D2),A
	POP	AF
	CALL	L4AAF
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5719	CALL	L55AE
	PUSH	HL
	LD	L,A
	CALL	L55AE
	LD	H,A
	LD	A,(L48D5)
	LD	(L48D2),A
	CALL	L4B60
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5733	PUSH	HL
	PUSH	BC
	LD	HL,L5548
	LD	C,D
	LD	B,#03
	CALL	L56AA
	POP	BC
	POP	HL
	RET
L5741	CALL	L5733
	LD	A,D
	OR	A
	RET	Z
	LD	A,#2B
	CALL	L56F3
	LD	A,(L48D1)
	DEC	A
	JR	NZ,L5702
	PUSH	HL
	LD	A,(L48D5)
	LD	(L48D2),A
	LD	A,(L48D0)
	CALL	L4AAF
	LD	A,(L48D2)
	LD	(L48D5),A
	POP	HL
	RET
L5767	PUSH	DE
	CALL	L55AE
	LD	HL,(L4B8B)
	DEC	HL
	CP	#80
	JR	C,L578E
	LD	E,A
	LD	A,#FF
	SUB	E
	LD	E,A
	LD	D,#00
	OR	A
	SBC	HL,DE
L577D	LD	A,(L48D5)
	LD	(L48D2),A
	CALL	L4B60
	POP	DE
	LD	A,(L48D2)
	LD	(L48D5),A
	RET
L578E	INC	A
	LD	E,A
	LD	D,#00
	ADD	HL,DE
	JR	L577D
L5795	LD	HL,(L4B8B)
	LD	DE,#0000
L579B	LD	(L48D2),DE
	PUSH	DE
	PUSH	BC
	CALL	L57B3
	CALL	L4FC5
	POP	BC
	POP	DE
	INC	D
	INC	HL
	DJNZ	L579B
	LD	DE,#15E0
	JP	L4E63
L57B3	PUSH	HL
	CALL	L4B60
	LD	A,#08
	LD	(L48D2),A
	POP	HL
	PUSH	HL
	LD	A,(HL)
	CALL	L4AAF
	CALL	L4FC5
	CALL	L4FC7
	LD	A,#0E
	LD	(L48D2),A
	POP	HL
	PUSH	HL
	LD	E,(HL)
	INC	HL
	LD	D,(HL)
	EX	DE,HL
	CALL	L4ABC
	LD	A,(L48D2)
	LD	B,A
	LD	A,#14
	SUB	B
	LD	B,A
L57DE	CALL	L4FC5
	DJNZ	L57DE
	LD	A,#16
	LD	(L48D2),A
	POP	HL
	LD	A,(HL)
	CP	#80
	JR	C,L57F6
	LD	A,#2F
	LD	(L4FF5),A
	LD	A,(HL)
	AND	#7F
L57F6	CP	#20
	CALL	NC,L4FC7
	XOR	A
	LD	(L4FF5),A
	RET

	ENT

LEN_PROG	EQU	$-PROG

